package com.hand.cloud.service;

import com.hand.cloud.dto.StudentVo;
import com.hand.cloud.result.Result;
import com.hand.cloud.entity.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Component
@FeignClient("CLOUD-EDUC-SYS")
public interface EducFeignService {
    @PostMapping("/hand/student/add")
    Result<Student> insertStudent(@RequestBody Student student);

    @GetMapping("/hand/student/{id}")
    Result<Student> getStudent(@PathVariable("id") Long id);

    @GetMapping("/hand/search/{name}")
    Result<List<Student>> searchStudent(@PathVariable(value = "name", required = false) String name);

    @GetMapping("/hand/search")
    Result<List<Student>> searchStudent();

    @GetMapping("/hand/student/all")
    Result<List<Student>> studentAll();

    @DeleteMapping("/hand/delete/{id}")
    Result<Integer> deleteStudent(@PathVariable("id") Long id);

    @PutMapping("/hand/update")
    Result<Student> updateStudent(@RequestBody Student student);

    @GetMapping("/hand/score-table/{id}")
    Result<StudentVo> getScoreTable(@PathVariable(value = "id") Long id);

    @GetMapping("/hand/score-table/all")
    Result<List<StudentVo>> getScoreTableAll();

    @PostMapping("/hand/student/add-score")
    Result<StudentVo> addScore(@RequestBody Map<String, Number> scoreMap);

    @PostMapping("/hand/student/add-score-beach")
    Result<List<StudentVo>> addScoreBeach(@RequestBody List<Map<String, Object>> scores);
}
